import frontRequest from "@/utils/http/frontRequest.js";

// 添加至购物车
export const cartAddAPI = (gameId) => {
    return frontRequest.post('/order/cart', {
        gameId
    })
}

// 购物车数据获取
export const cartListGetAPI = () => {
    return frontRequest.get('/order/cart/all')
}

// 删除购物车中的数据
export const cartGameDeleteAPI = (ids) => {
    return frontRequest.delete('/order/cart', {
        data: ids
    })
}

// 添加订单
export const orderAddAPI = (order) => {
    return frontRequest.post('/order', order)
}

// 查询订单是否有数据
export const checkOrderExist = () => {
    return frontRequest.get('/order/isexist')
}

// 查询订单内容
export const orderGetAPI = () => {
    return frontRequest.get('/order')
}

// 删除用户订单
export const orderDeleteAPI = () => {
    return frontRequest.delete('order')
}

// 下订单
export const orderPayAddAPI = ({orderNumber, payment}) => {
    return frontRequest.post('/order/pay', {orderNumber, payment})
}
